package hn.sigit.model.hnd.administrative;

import java.io.Serializable;

import hn.sigit.model.ladm.external.ExtParty;
import hn.sigit.model.hnd.administrative.HND_Transaction;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="HND_Request", schema="hnd_administrative")
@Inheritance(strategy=InheritanceType.JOINED)
public class HND_Request implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	private long presentationId;
	private java.util.Date presentationDate;
	private String cashiersCode;
	private java.math.BigDecimal payment;
	private String description;
	private String receptionistUserName;
	private String receptionistFullName;
	//TODO: private HND_ActivityType currentActivity;
	//TODO: private Date completionDate
	private hn.sigit.model.ladm.external.ExtParty extParty;
	private hn.sigit.model.hnd.administrative.HND_Transaction transaction;

	
	@Id
	@Column(name="ID", nullable=false)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="hnd_presentation_id_gen")
	@SequenceGenerator(name="hnd_presentation_id_gen", sequenceName="hnd_presentation_id_seq", allocationSize=1)
	public long getPresentationId() {
		return presentationId;
	}
	protected void setPresentationId(long value) {
		this.presentationId = value;
	}
	@Transient
	public long getORMID() {
		return getPresentationId();
	}
	
	@Column(name="PresentationDate", nullable=true)	
	public java.util.Date getPresentationDate() {
		return presentationDate;
	}
	public void setPresentationDate(java.util.Date value) {
		this.presentationDate = value;
	}
	
	@Column(name="CashiersCode", nullable=true, length=255)
	public String getCashiersCode() {
		return cashiersCode;
	}
	public void setCashiersCode(String value) {
		this.cashiersCode = value;
	}
	
	@Column(name="Payment", nullable=true, precision=14, scale=2)
	public java.math.BigDecimal getPayment() {
		return payment;
	}
	public void setPayment(java.math.BigDecimal value) {
		this.payment = value;
	}
	
	@Column(name="Description", nullable=true, length=255)
	public String getDescription() {
		return description;
	}
	public void setDescription(String value) {
		this.description = value;
	}
	
	@Column(name="ReceptionistUserName", nullable=true, length=255)
	public String getReceptionistUserName() {
		return receptionistUserName;
	}
	public void setReceptionistUserName(String value) {
		this.receptionistUserName = value;
	}
	
	@Column(name="ReceptionistFullName", nullable=true, length=255)
	public String getReceptionistFullName() {
		return receptionistFullName;
	}
	public void setReceptionistFullName(String value) {
		this.receptionistFullName = value;
	}
	
	@ManyToOne(targetEntity=ExtParty.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="ExtPartyID", referencedColumnName="ID") })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)
	public ExtParty getExtParty() {
		return extParty;
	}
	public void setExtParty(ExtParty extParty) {
		this.extParty = extParty;
	}

	@OneToOne(targetEntity=HND_Transaction.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="HND_RequestLA_SourceID") })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public HND_Transaction getTransaction() {
		return transaction;
	}
	public void setTransaction(HND_Transaction transaction) {
		this.transaction = transaction;
	}
	
	
	public String toString() {
		return String.valueOf(getPresentationId());
	}

}
